package kr.hkit.powerjava.chapter07.Programming;

public class Reverse {

	private int length;
	private String str, reverse;

	public Reverse(String str) {
		super();
		this.str = str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	String reverseStr() {

		length = str.length();
		reverse = str.substring(length - 1);
		for (int i = length - 2; i >= 0; i--) {
			reverse += str.charAt(i);
		}
		return reverse;
	}

	@Override
	public String toString() {
		reverseStr();
		return "사용자 입력: " + str + ", 역순: " + reverse;
	}
	
	

}
